home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / MSG Demo 1.4.source Folder / Demo ƒ / Wipes reversed ƒ / Two corner reversed.c < prev   
Text File  |  1994-04-15  |  3KB  |  76 lines

  1. /**********************************************************************\
  2.  
  3. File:        Two corner reversed.c
  4.  
  5. Purpose:    Graphic effect from offscreen bitmap to main window (on
  6.             screen).  See comments below for more description.
  7.  
  8. This program is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; either version 2 of the License, or
  11. (at your option) any later version.
  12.  
  13. This program is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. GNU General Public License for more details.
  17.  
  18. You should have received a copy of the GNU General Public License
  19. along with this program in a file named "GNU General Public License".
  20. If not, write to the Free Software Foundation, 675 Mass Ave,
  21. Cambridge, MA 02139, USA.
  22.  
  23. \**********************************************************************/
  24.  
  25. #include "timing.h"
  26.  
  27. #define CorrectTime 3
  28. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  29. #define theWindowWidth (boundsRect.right-boundsRect.left)
  30.  
  31. pascal short TwoCornerReversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  32.  
  33. /* One region starts at the top of the screen and moves down the left side
  34.    (making triangles with the bottomright of the screen).  The other region starts
  35.    at the bottom of the screen and moves up the right side (making triangles with
  36.    the topleft of the screen). */
  37.    
  38. pascal short TwoCornerReversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  39. {
  40.     RgnHandle        curregion;
  41.     int                gap;
  42.     int                BlockSize;
  43.     
  44.     BlockSize=theWindowHeight/25;
  45.     curregion=NewRgn();
  46.     gap=theWindowHeight;
  47.     do
  48.     {
  49.         StartTiming();
  50.         SetEmptyRgn(curregion);
  51.         MoveTo(0,0);
  52.         OpenRgn();
  53.             Line(theWindowWidth,gap);
  54.             Line(0,-BlockSize);
  55.             LineTo(0,0);
  56.             MoveTo(theWindowWidth,theWindowHeight);    /* region is discontinuous */
  57.             Line(-theWindowWidth,-gap);                /* but this is much faster */
  58.             Line(0,BlockSize);                        /* than two regions & two  */
  59.             LineTo(theWindowWidth,theWindowHeight);    /* CopyBits */
  60.         CloseRgn(curregion);
  61.         OffsetRgn(curregion, boundsRect.left, boundsRect.top);
  62.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  63.             &boundsRect, &boundsRect, 0, curregion);
  64.         gap-=BlockSize;
  65.         TimeCorrection(CorrectTime);
  66.     }
  67.     while (gap>=0);
  68.     
  69.     CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  70.         &boundsRect, &boundsRect, 0, 0L);    /* in case we missed any bits */
  71.     
  72.     DisposeRgn(curregion);
  73.     
  74.     return 0;
  75. }
  76.